package com.tempjob.common.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel
public class ResponseData<T> {

    @ApiModelProperty(value = "返回码")
    private String code;

    @ApiModelProperty(value = "错误信息")
    private String message;

    @ApiModelProperty(value = "返回数据体",hidden = true)
    private T data;

    public ResponseData() {
        this.code = ResponseCode.SUCCESS;
        this.message = "ok";
        this.data = null;
    }

    public ResponseData(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResponseData(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResponseData(T data) {
        this.code = ResponseCode.SUCCESS;
        this.message = "OK";
        this.data = data;
    }

}
